Availability and Quality Analysis Plot and Discussion -- Dataset for the SimAUD 2015 Conference

The goal of this analysis is to create plots to show the availability and quality of the data from the open dataset.

First, we'll look at the power meter data:

In [1]:
import pandas as pd
from matplotlib import ticker
In [2]:
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
import os
import matplotlib.dates as mdates
import datetime as dt

Load the raw datafile:

In [3]:
df = pd.read_csv("./SimAud_OpenDataSet.csv", parse_dates=True, index_col="Date Time")

Explore the dataset

In [5]:
df.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 70345 entries, 2006-01-01 00:00:00 to 2014-01-10 00:00:00
Columns: 389 entries, 26 to 1194
dtypes: float64(389)
memory usage: 209.3 MB

In [10]:
df.resample('W').plot(figsize=(20,300), subplots=True)
Out[10]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x1afad8a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1aff10a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1a027d610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1aff2f2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1aff86b10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x18ae2ee50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1aff9dfd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1affeb810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b0217c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1a593c910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b0623910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x128724810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1287361d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x128755850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x128765610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x128794750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cc95b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x12877e310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ccd1890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ccf5410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cd0fb50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cd336d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cd43290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cd71550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cd94950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cd5eb90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cdd1810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cdf3390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ce4dad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ce71650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ce82790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ceaf4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1286928d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ce9aa90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1286ce790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1286f1310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ced0a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cef85d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cf0a190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cf3f450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16d1e8850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16cf28550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16d22d710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16d256290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16d231cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1aa3b03d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1783c8dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x173e1d5d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x16ff07910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x175699250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197a2ce90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197a4ea10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197a6d190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197a8dcd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197aa1890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197ad5b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197afef50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197ac0150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197c43d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197c6c890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197c90110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197cb3c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197cc8810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197cfcad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198924ed0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x197ce80d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198969c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198994810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1989b7090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1989dabd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1989ef790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198b24a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198b4be50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198b0c490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198b91c10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198bb9790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198bd8fd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198f02b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198f16710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198f4a9d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198f72dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198f33490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198fb8b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x198fe2710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199400f50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199428ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19943c690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199471950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199499d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19945a4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1994dfb10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199808690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199826ed0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199850a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199863610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1998988d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1998c0cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1998814d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199b06a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199b2f610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199b4de50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199b769d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199b8c590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199bbe850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199be6c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x199ba7450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a82ca10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a856590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a874dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a89e950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a8b0510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a8e67d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ad0fbd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19a8cf390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ad55990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ad7c510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ad9ad50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19adc48d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19add7490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b00c750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b035b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19adf5cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b07a910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b0a3490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b0c2cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b0eb850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b0fe410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b4346d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b45bad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b41a250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b4a3890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b4cb410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b4eac50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b9137d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b927390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b95b650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b984a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b944c10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b9ca810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19b9f1390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bd11bd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bd3a750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bd4d310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bd815d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bdab9d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bd6bb90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19bdf0790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c81a310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c838b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c8606d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c873290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c8aa550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c8d2950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19c890b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19cc19710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19cc40290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19cc60ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19cc89650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19cc9c790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ccd14d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ccf98d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19ccb9a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d23e690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d267210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d287a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d2af5d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d2c4190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d2f7450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d520850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d2df550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d564610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d58f190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d5af9d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d5d7550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d5ea110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d9213d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d9487d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d908590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d98e590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d9b6110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d9d5950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19d9fd4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19dd11090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b4a23350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b4a4b750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x19dd2f350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b4a91510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b4aba090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b4ada8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6025450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6038090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b606e2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b60946d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b60542d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b60dc490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6400fd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6425850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b644d3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6461050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6495250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b64be650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b647d250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6764410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b6789f50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b67ab7d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b67d3350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7207490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b723c1d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b72655d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7225350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b72aa390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b72cfed0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b72f1750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b771b2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b772ce50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7765150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b778c550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b774c310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b77d3310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b77f6e50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7a1a6d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7a44250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7a54dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7a8c0d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7ab44d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7a74290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7af9290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7f1edd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7f42650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7f6a1d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7f7ad50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7fb3050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7fdc450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b7f9a1d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8221210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8246d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b82695d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8292150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b82a3cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b82d5f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b86033d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b82c30d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b864a190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b866ecd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8690550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b86bb0d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b86cac50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b86fef10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8b2a350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b86eb590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8b70110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8b94c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8bb94d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8be1050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8bf1bd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8f24e90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8f512d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8f10490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8f98090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8fbcbd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b8fe0450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9b04f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9b19b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9b4ce10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9b7a250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9b39410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9bbcfd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1b9be4b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba8063d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba82bf10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba840ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba873d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba8a11d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba860350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1ba8e3f50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bac0aad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bac2f350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bac54e90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bac68a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bac9cd10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bacca150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bac872d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb00aed0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb033a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb0572d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb07be10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb08f9d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb0c3c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb0f00d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb0af250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb432e50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb45a9d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb47e250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb4a1d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb4b5950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb4eac10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb818050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb4d7210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb858dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb882950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb8a61d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb8ccd10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb8df8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bbd13b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bbd39f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bb8fe190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bbd80d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bbda98d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bbdce150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bbdf1c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc005850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc03ab10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc061f10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc026110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc0a8cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc0d1850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc0f50d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc418c10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc42c7d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc461a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc48be90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc44d110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc4d0c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bc4f97d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bca1d050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bca40b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bca55750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bca89a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bcab0e10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bca72690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bcaf7bd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bce20750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bce40f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bce68b10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bce7c6d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bceb0990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bced9d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bce98450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdc1fb50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdc466d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdc66f10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdc90a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdca4650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdcd9910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdf01d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdcc1490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdf46ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdf71650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdf8ee90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdfb7a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdfcb5d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be301890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be327c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bdfe8490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be36ea50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be3975d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be3b5e10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be3de990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1be3f2550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf026810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf04fc10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf00f410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf0959d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf0be550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf0ddd90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf207910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf21b4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf24f790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf277b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf237d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf2bc950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf2e74d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf705d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf72e890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf742450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf777710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf79eb10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf75f2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bf7e58d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfc0d450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfc2cc90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfc54810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfc683d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfc9d690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfcc7a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1bfc87c10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1c000c850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1c00363d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1c0053c10>], dtype=object)

Detect NaN's and "Flat lined" data

  • Flat-lined data will be defined in this case as data in which the relative std dev is below a certain threshold

Let's look at a set of 10 streams as a example:

In [11]:
testcases = df.ix[:,1:10].resample("W")
In [12]:
testcases.plot(figsize=(20,10), subplots=True)
Out[12]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x1dc8a0110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1f6c85310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1e533d150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1dc891150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1d98f40d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1d7d4d310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1d6a32b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1d51ca410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1d2d579d0>], dtype=object)

Let's use the pandas tranform function to change the values for each day into the following ordinal values

  • NaN -- 0
  • 0 Values -- 1
  • Outliers -- 2
  • "Good Data" -- 3

First, filter out the outliers because they're dependent on the distributions

In [13]:
for datapoint in testcases.columns:
    print testcases[datapoint][np.abs(testcases[datapoint]) > (testcases[datapoint].mean() + 3 * testcases[datapoint].std())]
Series([], name: 27, dtype: float64)
Date Time
2006-07-16    307.485119
2006-07-30    336.276786
2009-08-23    337.763345
2010-07-04    313.761775
2010-07-18    355.440522
2011-08-28    362.457774
Name: 28, dtype: float64
Date Time
2011-05-29    784.935882
2011-06-05    734.568284
2011-06-12    779.619010
2011-06-19    766.378854
2011-06-26    780.762936
Freq: W-SUN, Name: 32, dtype: float64
Series([], name: 34, dtype: float64)
Date Time
2006-07-16    395.797619
2006-07-23    396.660714
2006-07-30    420.421131
2007-07-22    392.580357
2008-06-29    420.693452
2013-07-28    415.241815
Name: 35, dtype: float64
Date Time
2013-01-20    170.26201
Freq: W-SUN, Name: 63, dtype: float64
Date Time
2009-03-08    4.285714
Freq: W-SUN, Name: 67, dtype: float64
Series([], name: 68, dtype: float64)
Series([], name: 69, dtype: float64)

In [14]:
outliers = pd.DataFrame()
for datapoint in testcases.columns:
#     #The outliers first = 2
#     testcases[datapoint][np.abs(testcases[datapoint]) > (testcases[datapoint].mean() + 3 * testcases[datapoint].std())]) = 2
#     #Then non-outliers = 3
#     print datapoint
    tempset =  pd.DataFrame(testcases[datapoint][np.abs(testcases[datapoint]) > (testcases[datapoint].mean() + 3 * testcases[datapoint].std())])
    outliers = pd.merge(outliers, tempset, right_index=True, left_index=True, how='outer')
In [15]:
outliers[outliers.isnull() == False] = 2

Now, let's filter out the NaN, 0, and all other values

In [16]:
zeros = testcases[testcases == 0]
NaNs = testcases[testcases == np.nan]
In [17]:
zeros.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 420 entries, 2006-01-01 00:00:00 to 2014-01-12 00:00:00
Freq: W-SUN
Data columns (total 9 columns):
27    0 non-null float64
28    0 non-null float64
32    0 non-null float64
34    0 non-null float64
35    0 non-null float64
63    0 non-null float64
67    317 non-null float64
68    51 non-null float64
69    180 non-null float64
dtypes: float64(9)
memory usage: 32.8 KB

Transform the dataframe into the discrete variables

In [18]:
testcases[testcases>0].info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 420 entries, 2006-01-01 00:00:00 to 2014-01-12 00:00:00
Freq: W-SUN
Data columns (total 9 columns):
27    419 non-null float64
28    419 non-null float64
32    419 non-null float64
34    1 non-null float64
35    419 non-null float64
63    418 non-null float64
67    99 non-null float64
68    369 non-null float64
69    239 non-null float64
dtypes: float64(9)
memory usage: 32.8 KB

In [19]:
testcases[testcases > 0] = 3
testcases[testcases <= 0] = 1

Update the dataframe with outliers extracted previously: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.update.html

In [20]:
testcases.update(outliers)
testcases.fillna(value=0, inplace=True)
In [21]:
testcases.plot(figsize=(20,10), subplots=True)
Out[21]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x1ef2ab050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1f8cecdd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1f8cfcf50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1f8ce4a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1fdc9e8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1fdcb3f50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1fdc43910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1fdc58f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1fdc63e50>], dtype=object)
In [22]:
SPINE_COLOR = 'gray'
In [23]:
SPINE_COLOR = 'gray'

def latexify(fig_width=None, fig_height=None, columns=1):
    """Set up matplotlib's RC params for LaTeX plotting.
    Call this before plotting a figure.

    Parameters
    ----------
    fig_width : float, optional, inches
    fig_height : float,  optional, inches
    columns : {1, 2}
    """

    # code adapted from http://www.scipy.org/Cookbook/Matplotlib/LaTeX_Examples

    # Width and max height in inches for IEEE journals taken from
    # computer.org/cms/Computer.org/Journal%20templates/transactions_art_guide.pdf

    assert(columns in [1,2])

    if fig_width is None:
        fig_width = 3.39 if columns==1 else 6.9 # width in inches

    if fig_height is None:
        golden_mean = (sqrt(5)-1.0)/2.0    # Aesthetic ratio
        fig_height = fig_width*golden_mean # height in inches

    MAX_HEIGHT_INCHES = 8.0
    if fig_height > MAX_HEIGHT_INCHES:
        print("WARNING: fig_height too large:" + fig_height + 
              "so will reduce to" + MAX_HEIGHT_INCHES + "inches.")
        fig_height = MAX_HEIGHT_INCHES

    params = {'backend': 'ps',
              'text.latex.preamble': ['\usepackage{gensymb}'],
              'axes.labelsize': 10, # fontsize for x and y labels (was 10)
              'axes.titlesize': 10,
              'text.fontsize': 10, # was 10
              'legend.fontsize': 8, # was 10
              'xtick.labelsize': 8,
              'ytick.labelsize': 10,
              'text.usetex': True,
              'figure.figsize': [fig_width,fig_height],
              'font.family': 'serif'
    }

    matplotlib.rcParams.update(params)


def format_axes(ax):

    for spine in ['top', 'right']:
        ax.spines[spine].set_visible(False)

    for spine in ['left', 'bottom']:
        ax.spines[spine].set_color(SPINE_COLOR)
        ax.spines[spine].set_linewidth(0.5)

    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')

    for axis in [ax.xaxis, ax.yaxis]:
        axis.set_tick_params(direction='out', color=SPINE_COLOR)

    return ax
In [24]:
latexify(fig_height=6)

numberofplots = 1
fig = plt.figure()

# Get the data
x = mdates.drange(testcases.index[0], testcases.index[-1] + datetime.timedelta(weeks=1), dt.timedelta(weeks=1))
y = np.linspace(1, len(testcases.columns), len(testcases.columns))

# Plot
ax = fig.add_subplot(numberofplots, 1, 1)

data = np.array(testcases.T)

cmap = cm.get_cmap('Reds', 4)

qmesh = ax.pcolormesh(x, y, data, cmap=cmap)
cbar = fig.colorbar(qmesh, ax=ax)
cbar.ax.tick_params(labelsize= 12)
tick_locator = ticker.MaxNLocator(nbins=3)
cbar.locator = tick_locator
cbar.update_ticks()
ax.axis('tight')

# try:
#     plt.title(MasterPointList[(MasterPointList.Name == mappingname)].Name.iloc[0] + "/" + 
#           MasterPointList[(MasterPointList.Name == mappingname)].English_Description2.iloc[0] + 
#           "/"+ MasterPointList[(MasterPointList.Name == mappingname)].Description2.iloc[0], fontsize=26)

# except IndexError:
# continue

# Set up as dates
ax.xaxis_date()
#ax.yaxis.set_ticks()
fig.autofmt_xdate()
fig.subplots_adjust(hspace=.5)

format_axes(ax)
/Users/millerc/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/__init__.py:855: UserWarning: text.fontsize is deprecated and replaced with font.size; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))

Out[24]:
<matplotlib.axes._subplots.AxesSubplot at 0x16d090890>

Let's try it with all the points

In [25]:
df_daily = df.resample('W')
In [26]:
outliers = pd.DataFrame()
for datapoint in df_daily.columns:
    tempser = pd.DataFrame(df_daily[datapoint][np.abs(df_daily[datapoint]) > (df_daily[datapoint].mean() + 3 * df_daily[datapoint].std())])
    outliers = pd.merge(outliers, tempser, right_index=True, left_index=True, how='outer')
    
outliers[outliers.isnull() == False] = 2
df_daily[df_daily > 0] = 3
df_daily[df_daily <= 0] = 1

df_daily.update(outliers)
df_daily.fillna(value=0, inplace=True)

Output the results for replication without having to redo the above analysis

In [27]:
df_daily.to_csv('AvailabilityAnalysisResuldf_daily.csv')

Ok, now plot it

In [44]:
latexify(fig_height = 6)

numberofplots = 1
fig = plt.figure()

# Get the data
x = mdates.drange(df_daily.index[0], df_daily.index[-1] + datetime.timedelta(weeks=1), dt.timedelta(weeks=1))
y = np.linspace(1, len(df_daily.columns), len(df_daily.columns))

# Plot
ax = fig.add_subplot(numberofplots, 1, 1)

data = np.array(df_daily.T)

cmap = cm.get_cmap('Reds', 4)

qmesh = ax.pcolormesh(x, y, data, cmap=cmap)

cbaxes = fig.add_axes([0.2, 0.1, 0.7, 0.02]) 
cbar = fig.colorbar(qmesh, ax=ax, orientation='horizontal', cax = cbaxes)
cbar.ax.tick_params(length = 0)
tick_locator = ticker.MaxNLocator(nbins=3)
cbar.locator = tick_locator
cbar.update_ticks()
cbar.set_label('Quality Metric')

ax.axis('tight')

# try:
#     plt.title(MasterPointList[(MasterPointList.Name == mappingname)].Name.iloc[0] + "/" + 
#           MasterPointList[(MasterPointList.Name == mappingname)].English_Description2.iloc[0] + 
#           "/"+ MasterPointList[(MasterPointList.Name == mappingname)].Description2.iloc[0], fontsize=26)

# except IndexError:
# continue

# Set up as dates
ax.xaxis_date()
#ax.yaxis.set_ticks()
fig.autofmt_xdate()
fig.subplots_adjust(hspace=.5)

ax.set_xlabel("Timeline")
ax.set_ylabel("Number of Points")
ax.set_title("kWh Meter Quality Screening")
plt.tight_layout()
plt.subplots_adjust(bottom=0.22)

format_axes(ax)

plt.savefig("availability_map.png", dpi=500)

Let's sort and then replot

In [29]:
df_daily_sorted = df_daily.T.ix[df_daily.T.sum(axis=1).order().index]
In [30]:
df_daily_sorted.head()
Out[30]:
Date Time 2006-01-01 00:00:00 2006-01-08 00:00:00 2006-01-15 00:00:00 2006-01-22 00:00:00 2006-01-29 00:00:00 2006-02-05 00:00:00 2006-02-12 00:00:00 2006-02-19 00:00:00 2006-02-26 00:00:00 2006-03-05 00:00:00 ... 2013-11-10 00:00:00 2013-11-17 00:00:00 2013-11-24 00:00:00 2013-12-01 00:00:00 2013-12-08 00:00:00 2013-12-15 00:00:00 2013-12-22 00:00:00 2013-12-29 00:00:00 2014-01-05 00:00:00 2014-01-12 00:00:00
355 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1
385 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1
244 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1
393 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1
303 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 1

5 rows × 420 columns

In [31]:
latexify(fig_height = 6)

numberofplots = 1
fig = plt.figure()

# Get the data
x = mdates.drange(df_daily_sorted.T.index[0], df_daily_sorted.T.index[-1] + datetime.timedelta(weeks=1), dt.timedelta(weeks=1))
y = np.linspace(1, len(df_daily_sorted.T.columns), len(df_daily_sorted.T.columns))

# Plot
ax = fig.add_subplot(numberofplots, 1, 1)

data = np.array(df_daily_sorted)

cmap = cm.get_cmap('Reds', 4)

qmesh = ax.pcolormesh(x, y, data, cmap=cmap)

cbaxes = fig.add_axes([0.2, 0.1, 0.7, 0.02]) 
cbar = fig.colorbar(qmesh, ax=ax, orientation='horizontal', cax = cbaxes)
cbar.ax.tick_params(length = 0)
tick_locator = ticker.MaxNLocator(nbins=3)
cbar.locator = tick_locator
cbar.update_ticks()
cbar.set_label('Quality Metric')

ax.axis('tight')

# try:
#     plt.title(MasterPointList[(MasterPointList.Name == mappingname)].Name.iloc[0] + "/" + 
#           MasterPointList[(MasterPointList.Name == mappingname)].English_Description2.iloc[0] + 
#           "/"+ MasterPointList[(MasterPointList.Name == mappingname)].Description2.iloc[0], fontsize=26)

# except IndexError:
# continue

# Set up as dates
ax.xaxis_date()
#ax.yaxis.set_ticks()
fig.autofmt_xdate()
fig.subplots_adjust(hspace=.5)

ax.set_xlabel("Timeline")
ax.set_ylabel("Number of Points")
ax.set_title("kWh Meter Quality Screening")
plt.tight_layout()
plt.subplots_adjust(bottom=0.22)

format_axes(ax)

plt.savefig("availability_map_sorted.png", dpi=500)
/Users/millerc/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/figure.py:1644: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect.
  warnings.warn("This figure includes Axes that are not "

Cool, now let's zoom on a specific datapoint stream and show it individually with the colors

Let's find the best candidate by doing a subplot of all the points

In [32]:
df_daily.plot(figsize=(20,400), subplots=True)
Out[32]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x16d08c890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2091a0650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2091bd7d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1df78b590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x1e07c1310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2091d8990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2091f8350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2099c19d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2099d4890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209e24a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209e4ce90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209e2c850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209e90290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209eb9910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209ed82d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x209efe950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a111810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a144a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a16be10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a14c7d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a1b2210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a1d6890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a1f6250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a71d8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a730790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a764990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a78dd90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a76c910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a7d0190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20a7f6810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ac171d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ac3e850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ac4f710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ac83910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20acabd10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ac8a890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20acf1110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ae16790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ae37150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ae5e7d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ae70690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20aea5890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20aecdc90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20aeab810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b313090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b339710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b35b0d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b381650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b396410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b3ca650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b3f1a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b3b3f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b638790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b661310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b680a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b6a95d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b6bd190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b6f1450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20bc1b850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20b6da550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20bc60610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20bc88190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20bca89d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20bcd0550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20bce4110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d0193d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d0427d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d001590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d087590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d0af110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d0cf950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d0f84d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d40b090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d440350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d468750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d428350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d4ad510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d4d8090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d4f78d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d821450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d833090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d8672d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d88f6d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d84f2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d8d5490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20d8f9fd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20db1d850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20db453d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20db5a050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20db8e250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20dbb7650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20db76250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20dbfc410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e921f50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e9447d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e96c350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e97f490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e9b51d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e9de5d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20e99d390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ec24390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ec48ed0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ec6d750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ec942d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20eca5e50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ecde150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f004550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20ecc5310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f04b310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f06fe50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f0936d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f0bc250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f0ccdd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f5040d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f52d4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f0ec290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f571290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f596dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f5ba650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f5e31d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20f5f4d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fa2c050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fa54450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fa131d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fa99210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fabed50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fae15d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fc09150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fc1acd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fc4ff90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fc7b3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fc3b0d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fcc1190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x20fce5cd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210108550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2101320d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210142c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210175f10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2101a1350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210161590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2101e8110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21040dc50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2104314d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21045a050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210469bd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21049de90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2104ca2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210488490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210911090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210934bd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210957450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21097bf90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210990b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2109c2e10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2109f1250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2109b1410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210d32fd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210d5bb50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210d7d3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210da2f10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210db8ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210debd90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2118181d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x210dd7390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21185af50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211882ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2118a6350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2118cbe90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2118dfa50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211d12d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211d40150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2118fe2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211d81ed0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211daaa50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211dcd2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x211df0e10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2121049d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212138c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2121670d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212126250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2121a6e50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2121d09d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2121f4250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212619d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21262e950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212661c10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21268e050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21264c210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2126d0dd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2126f7950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21291b1d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212941d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2129538d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212988b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2129b0f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212974190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2129f6d50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212e1e8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212e43150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212e67c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212e7b850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212eafb10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212ed8f10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x212e9a110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21387fcd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2138a7850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2138cb0d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213c0fc10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213c227d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213c57a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213c80e90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213c43110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213cc5c50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x213cee7d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214112050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214137b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21414a750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21417fa10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2141a5e10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214166690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2141ecbd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214415750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214435f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21445db10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2144726d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2144a7990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2144ced90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214490450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214814b50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21483d6d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21485df10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214885a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214899650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2148ce910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2148f6d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2148b6490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214d3bad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214d66650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214d84e90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214daba10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214dc15d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214df4890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21591cc90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x214ddd490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215963a50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21598c5d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2159ace10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2159d5990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2159e9550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215d1e810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215d45c10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215d06410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215d8b9d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215db3550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215dd4d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x215dfc910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21610f4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216144790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21616db90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21612bd10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2161b1950>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2161dc4d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2161fad10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216522890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216537450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21656c710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216593b10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2165542d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2165db8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216904450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216921c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21694b810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21695f3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216994690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2169bba90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21697dc10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216e02850>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216e2a3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216e4ac10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216e73790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216e86350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216ebb610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216ee3a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x216ea2bd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2172287d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x217251350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x217271b90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x217299710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2172ae2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2172e3590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21750c990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2172cbb10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x217551750>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21757b2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x217598b10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2175c2690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2175d5250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21820a510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218232910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2175f3ad0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2182796d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2182a1250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2182c0a90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2182e8610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2182fc1d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218630490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218659890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218619a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2186a0650>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2186c81d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2186e8a10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218b12590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218b25150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218b59410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218b82810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218b42510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218bc75d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218bf0150>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218e0f990>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218e39510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218e4a0d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218e81390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218ea9790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218e69390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x218eef550>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2192180d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x219237910>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21925e490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x219273050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2192a7310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2192d1710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21928f310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2196174d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21963f050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21965d890>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x219689410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21969b050>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2196cf290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2196f9690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x2196b8450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a33e450>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a361f90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a387810>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a3b0390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a3bef10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a3f8210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a81f610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a3df3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a8643d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a88af10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a8ae790>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a8d5310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21a8eb3d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ab1f190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ab48590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ab07310>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ab8d350>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21abb1e90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21abd4710>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21abfe290>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ae0ee10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ae46110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ae6d510>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ae2e2d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21aeb42d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21aed8e10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21aefd690>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21bb26210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21bb35d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21bb6f090>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21bb95490>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21bb55210>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21bbdd250>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c801d90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c825610>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c84d190>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c85dd10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c891fd0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c8bf410>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21c87e110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cc031d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cc28d10>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cc4c590>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cc74110>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cc84c90>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21ccb8f50>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cce4390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21cca45d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x21d12b150>], dtype=object)

Pick a point - 1169

In [33]:
targetedpoint = df["1169"]
targetedpoint.resample('D').truncate(before='2011-12-01', after='2012-06-01').plot()
Out[33]:
<matplotlib.axes._subplots.AxesSubplot at 0x228c5e5d0>
In [34]:
targetedmetric = df_daily["1169"]
targetedmetric.truncate(before='2011-12-01', after='2012-06-01').plot()
Out[34]:
<matplotlib.axes._subplots.AxesSubplot at 0x255107e50>
In [50]:
latexify(columns=1)

numberofplots = 1
fig = plt.figure()

# Plot
ax = fig.add_subplot(numberofplots, 1, 1)

y = targetedpoint.resample('D').truncate(before='2011-12-01', after='2012-06-01').values
x = np.arange(len(y))

t = targetedmetric.truncate(before='2011-12-01', after='2012-06-01').values

ax.plot(x, y, c='black', )

ymin, ymax = ax.get_ybound()
xmin, xmax = ax.get_xbound()

cmap = cm.get_cmap('Reds', 4)


im = ax.imshow(t.reshape(1, t.size), extent=[xmin,x.max(),ymin,ymax], alpha=.5, cmap=cmap, interpolation='none')

ax.set_xlabel("Timeline")
ax.set_ylabel("Point Number")
ax.set_title("kWh Meter Quality Screening")
plt.tight_layout()
plt.subplots_adjust(bottom=0.22)

format_axes(ax)

plt.savefig("availability_singleplot.png", dpi=1000)
plt.show()

different point

In [51]:
targetedpoint = df["806"]
targetedpoint.resample('D').truncate(before='2008-04-01', after='2009-02-01').plot()
Out[51]:
<matplotlib.axes.AxesSubplot at 0x1257c4050>
In [52]:
targetedmetric = df_daily["806"]
targetedmetric.truncate(before='2008-04-01', after='2009-02-01').plot()
Out[52]:
<matplotlib.axes.AxesSubplot at 0x123eff0d0>
In [53]:
latexify()

numberofplots = 1
fig = plt.figure()

# Plot
ax = fig.add_subplot(numberofplots, 1, 1)

y = targetedpoint.resample('D').truncate(before='2008-04-01', after='2009-02-01').values
# x = mdates.drange(targetedpoint.index[0], targetedpoint.index[-1] + datetime.timedelta(days=1), dt.timedelta(days=1))
x = np.arange(len(y))

t = targetedmetric.truncate(before='2008-04-01', after='2009-02-01').values

ax.plot(x, y, c='black')

ymin, ymax = ax.get_ybound()
xmin, xmax = ax.get_xbound()

cmap = cm.get_cmap('Reds', 4)


im = ax.imshow(t.reshape(1, t.size), extent=[xmin,x.max(),ymin,ymax], alpha=.5, cmap=cmap, interpolation='nearest')
# ax.set_aspect(ax[0].get_aspect())
# ax.set_title(point)

# cax = fig.add_axes([0.2, 0.1, 0.7, 0.02])
# fig.colorbar(im, cax=cax, orientation='horizontal')

cbaxes = fig.add_axes([0.2, 0.2, 0.7, 0.02]) 
cbar = fig.colorbar(im, orientation='horizontal', cax = cbaxes)
cbar.ax.tick_params(length = 0)
tick_locator = ticker.MaxNLocator(nbins=3)
cbar.locator = tick_locator
cbar.update_ticks()
cbar.set_label('Quality Metric')

# # Set up as dates
# ax.xaxis_date()
# #ax.yaxis.set_ticks()
# fig.autofmt_xdate()
# fig.subplots_adjust(hspace=.5)

ax.set_xlabel("Days")
ax.set_ylabel("Energy [kWh]")
ax.set_title("Single Datastream Example")
plt.tight_layout()
plt.subplots_adjust(bottom=0.4)

format_axes(ax)

plt.savefig("availability_singleplot.pdf")
In []: